<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box1">box1</div>
    <div class="box2">box2</div>
    <h3><span><input type="button" value="提交"></span></h3>
    <div><input type="text" id="textInput"></div>
</body>
<script>
    // 选择文本输入框
    let input = document.querySelector('#textInput');
    input.onkeydown = function(event) {
        console.log("键盘正在按下", event.key);
    }
</script>
</html>